From d289436fbbf73155f6ed2b0098d98ff37da2ed0c Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20H=C3=A4rdeman?= Date: Wed, 15 Oct 2025 18:02:21 +0200 Subject: [PATCH] luci-mod-network: organize "devices" tab in dhcp/dns views MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Sort the options in the "devices" tab so that they are all grouped together in the order they appear in the UI and delete ones that are specific to DNS from dhcp.js and vice versa. Note that this means that the "nonwildcard", "interface" and "notinterface" options are present in both views, since they control the interfaces that dnsmasq listens to both for DNS and DHCP. We might consider adding a help text blurb explaining that, but I've intentionally not changed any code in these patches. Signed-off-by: David Härdeman --- .../resources/view/network/dhcp.js | 72 ++++--------- .../luci-static/resources/view/network/dns.js | 102 +++++++++--------- 2 files changed, 74 insertions(+), 100 deletions(-) diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js index 1b4af65472..f029a3a7b8 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js @@ -419,6 +419,28 @@ return view.extend({ o.optional = true; // End general + // Begin devices + o = s.taboption('devices', form.Flag, 'nonwildcard', + _('Non-wildcard'), + _('Bind only to configured interface addresses, instead of the wildcard address.')); + o.default = o.enabled; + o.optional = false; + o.rmempty = true; + + o = s.taboption('devices', widgets.NetworkSelect, 'interface', + _('Listen interfaces'), + _('Listen only on the specified interfaces, and loopback if not excluded explicitly.')); + o.multiple = true; + o.nocreate = true; + + o = s.taboption('devices', widgets.NetworkSelect, 'notinterface', + _('Exclude interfaces'), + _('Do not listen on the specified interfaces.')); + o.loopback = true; + o.multiple = true; + o.nocreate = true; + // End devices + s.taboption('filteropts', form.Flag, 'domainneeded', _('Domain required'), _('Never forward DNS queries which lack dots or domain parts.') + '
' + @@ -495,26 +517,6 @@ return view.extend({ o.optional = false; o.rmempty = false; - o = s.taboption('devices', form.Flag, 'nonwildcard', - _('Non-wildcard'), - _('Bind only to configured interface addresses, instead of the wildcard address.')); - o.default = o.enabled; - o.optional = false; - o.rmempty = true; - - o = s.taboption('devices', widgets.NetworkSelect, 'interface', - _('Listen interfaces'), - _('Listen only on the specified interfaces, and loopback if not excluded explicitly.')); - o.multiple = true; - o.nocreate = true; - - o = s.taboption('devices', widgets.NetworkSelect, 'notinterface', - _('Exclude interfaces'), - _('Do not listen on the specified interfaces.')); - o.loopback = true; - o.multiple = true; - o.nocreate = true; - o = s.taboption('relay', form.SectionValue, '__relays__', form.TableSection, 'relay', null, _('Relay DHCP requests elsewhere. OK: v4↔v4, v6↔v6. Not OK: v4↔v6, v6↔v4.') + '
' + _('Note: you may also need a DHCP Proxy (currently unavailable) when specifying a non-standard Relay To port(addr#port).') @@ -731,36 +733,6 @@ return view.extend({ o.optional = true; o.placeholder = '64.94.110.11'; - o = s.taboption('devices', form.Value, 'port', - _('DNS server port'), - _('Listening port for inbound DNS queries.')); - o.optional = true; - o.datatype = 'port'; - o.placeholder = 53; - - o = s.taboption('devices', form.Value, 'queryport', - _('DNS query port'), - _('Fixed source port for outbound DNS queries.')); - o.optional = true; - o.datatype = 'port'; - o.placeholder = _('any'); - - o = s.taboption('devices', form.Value, 'minport', - _('Minimum source port #'), - _('Min valid value %s.').format('1024') + ' ' + _('Useful for systems behind firewalls.')); - o.optional = true; - o.datatype = 'port'; - o.placeholder = 1024; - o.depends('queryport', ''); - - o = s.taboption('devices', form.Value, 'maxport', - _('Maximum source port #'), - _('Max valid value %s.').format('65535') + ' ' + _('Useful for systems behind firewalls.')); - o.optional = true; - o.datatype = 'port'; - o.placeholder = 50000; - o.depends('queryport', ''); - o = s.taboption('limits', form.Value, 'dhcpleasemax', _('Max. DHCP leases'), _('Maximum allowed number of active DHCP leases.')); diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dns.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dns.js index 61b09b84a6..9818181e86 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dns.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dns.js @@ -469,6 +469,58 @@ return view.extend({ }); // End cache + // Begin devices + o = s.taboption('devices', form.Flag, 'nonwildcard', + _('Non-wildcard'), + _('Bind only to configured interface addresses, instead of the wildcard address.')); + o.default = o.enabled; + o.optional = false; + o.rmempty = true; + + o = s.taboption('devices', widgets.NetworkSelect, 'interface', + _('Listen interfaces'), + _('Listen only on the specified interfaces, and loopback if not excluded explicitly.')); + o.multiple = true; + o.nocreate = true; + + o = s.taboption('devices', widgets.NetworkSelect, 'notinterface', + _('Exclude interfaces'), + _('Do not listen on the specified interfaces.')); + o.loopback = true; + o.multiple = true; + o.nocreate = true; + + o = s.taboption('devices', form.Value, 'port', + _('DNS server port'), + _('Listening port for inbound DNS queries.')); + o.optional = true; + o.datatype = 'port'; + o.placeholder = 53; + + o = s.taboption('devices', form.Value, 'queryport', + _('DNS query port'), + _('Fixed source port for outbound DNS queries.')); + o.optional = true; + o.datatype = 'port'; + o.placeholder = _('any'); + + o = s.taboption('devices', form.Value, 'minport', + _('Minimum source port #'), + _('Min valid value %s.').format('1024') + ' ' + _('Useful for systems behind firewalls.')); + o.optional = true; + o.datatype = 'port'; + o.placeholder = 1024; + o.depends('queryport', ''); + + o = s.taboption('devices', form.Value, 'maxport', + _('Maximum source port #'), + _('Max valid value %s.').format('65535') + ' ' + _('Useful for systems behind firewalls.')); + o.optional = true; + o.datatype = 'port'; + o.placeholder = 50000; + o.depends('queryport', ''); + // End devices + s.taboption('filteropts', form.Flag, 'domainneeded', _('Domain required'), _('Never forward DNS queries which lack dots or domain parts.') + '
' + @@ -544,26 +596,6 @@ return view.extend({ o.optional = false; o.rmempty = false; - o = s.taboption('devices', form.Flag, 'nonwildcard', - _('Non-wildcard'), - _('Bind only to configured interface addresses, instead of the wildcard address.')); - o.default = o.enabled; - o.optional = false; - o.rmempty = true; - - o = s.taboption('devices', widgets.NetworkSelect, 'interface', - _('Listen interfaces'), - _('Listen only on the specified interfaces, and loopback if not excluded explicitly.')); - o.multiple = true; - o.nocreate = true; - - o = s.taboption('devices', widgets.NetworkSelect, 'notinterface', - _('Exclude interfaces'), - _('Do not listen on the specified interfaces.')); - o.loopback = true; - o.multiple = true; - o.nocreate = true; - o = s.taboption('relay', form.SectionValue, '__relays__', form.TableSection, 'relay', null, _('Relay DHCP requests elsewhere. OK: v4↔v4, v6↔v6. Not OK: v4↔v6, v6↔v4.') + '
' + _('Note: you may also need a DHCP Proxy (currently unavailable) when specifying a non-standard Relay To port(addr#port).') @@ -780,36 +812,6 @@ return view.extend({ o.optional = true; o.placeholder = '64.94.110.11'; - o = s.taboption('devices', form.Value, 'port', - _('DNS server port'), - _('Listening port for inbound DNS queries.')); - o.optional = true; - o.datatype = 'port'; - o.placeholder = 53; - - o = s.taboption('devices', form.Value, 'queryport', - _('DNS query port'), - _('Fixed source port for outbound DNS queries.')); - o.optional = true; - o.datatype = 'port'; - o.placeholder = _('any'); - - o = s.taboption('devices', form.Value, 'minport', - _('Minimum source port #'), - _('Min valid value %s.').format('1024') + ' ' + _('Useful for systems behind firewalls.')); - o.optional = true; - o.datatype = 'port'; - o.placeholder = 1024; - o.depends('queryport', ''); - - o = s.taboption('devices', form.Value, 'maxport', - _('Maximum source port #'), - _('Max valid value %s.').format('65535') + ' ' + _('Useful for systems behind firewalls.')); - o.optional = true; - o.datatype = 'port'; - o.placeholder = 50000; - o.depends('queryport', ''); - o = s.taboption('limits', form.Value, 'dhcpleasemax', _('Max. DHCP leases'), _('Maximum allowed number of active DHCP leases.')); -- 2.30.2